import pytesseract
from PIL import Image
from ShowapiRequest import ShowapiRequest


# 安装tesseract和pytesseract, Tesseract-OCR 对截取的验证码图片进行处理

# image = Image.open("E:/timg.jpg")
# text = pytesseract.image_to_string(image)
#
# print(text)


r = ShowapiRequest("http://route.showapi.com/184-4","62626","d61950be50dc4dbd9969f741b8e730f5" )
r.addBodyPara("typeId", "35")
r.addBodyPara("convert_to_jpg", "0")
r.addBodyPara("needMorePrecise", "0")
r.addFilePara("image", r"E:/code1.png") #文件上传时设置
res = r.post()
text = res.json()['showapi_res_body']['Result']
print(text) # 返回信息
